N = 600851475143

def isPrime(n):
	n = abs(n)
	if (n < 4):
		return True
	else:	
		for i in range(2, (n/2)+1):
			if (n % i == 0):
				return False
	return True			

if __name__ == "__main__":
	max_factor = 0
	n = 2
	prod = 1
	while (n < N/2) and (prod != N):
		if (N % n == 0) and isPrime(n) and (n > max_factor):
			prod *= n
			max_factor = n
		n += 1	
	print "\n", max_factor, "\n"
